package reflect;

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

/*
使用当前类测试反射机制
 */
@AutoRunClass
public class Person {

    private String name = "爱丽丝";
    private String age = "一岁";
    //@AutoRunClass
    public Person() {
    }

    public Person( String name,  String age) {
        this.name = name;
        this.age = age;
    }

    @AutoRunMethod(2)
    public void sayHello(){
        System.out.println(name + ": hello!");
    }

    public void sayHi(){
        System.out.println(name + ": hi!");
    }

    public void sayGoodbye(){
        System.out.println(name + ": bye!");
    }
    @AutoRunMethod(3)
    public void watchTV(){
        System.out.println(name + ": 看电视!");
    }
    @AutoRunMethod(4)
    public void playGame(){
        System.out.println(name + ": 玩游戏!");
    }

    public void say(String info){
        System.out.println(info);
    }


    public void say(String info , int count){
        for (int i = 0; i < count; i++) {
            System.out.println(info);
        }
    }

    private void hei(){
        System.out.println("(╬▔皿▔)╯");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                '}';
    }
}
